package com.molin.API.test1;

import java.util.Scanner;

public class Demo5PhoneNum {
    //实现手机号码屏蔽 181****7908
    //str.charAt(1);
    public static void main(String[] args) {
        System.out.println("input a phoneNumber: ");
        Scanner sc=new Scanner(System.in);
        String pn=sc.nextLine();
        System.out.println("Out : ");
        String qiansan=new String();
        String housi=new String();
        for(int i=0;i<pn.length();i++) {
            if (i < 3) {
                qiansan += pn.charAt(i);
            }
            if (i > 6) {
                housi += pn.charAt(i);
            }
        }
        String endPhoneNum=qiansan+"****"+housi;
        System.out.println(endPhoneNum);
    }
}
